/*
 *    Copyright (c) 2018-2025, boss All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the boss developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: boss
 */

package com.hopes.bizz.poll.monitor.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.hopes.bizz.poll.common.constant.enums.PollModDictEnum;
import com.hopes.boss.admin.api.resolver.DictResolver;
import com.hopes.boss.admin.api.resolver.enums.SysDictEnum;
import com.hopes.boss.common.entity.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;

/**
 * 监控点监控因子
 *
 * @author yumr
 * @date 2023-05-22 14:47:33
 */
@Data
@TableName("poll_monitor_factor")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "监控点监控因子")
public class PollMonitorFactorEntity extends BaseEntity {

    private static final long serialVersionUID = 1L;


	/**
	* id
	*/
    @TableId(type = IdType.ASSIGN_ID)
    @Schema(description="id")
    private Long id;

	/**
	* 监控点
	*/
    @Schema(description="监控点")
    private Long monitorSiteId;

	/**
	* 监控因子
	*/
    @Schema(description="监控因子")
    private Long factorId;

	/**
	* 因子编码
	*/
    @Schema(description="因子编码")
    private String factorCode;

	/**
	* 是否启用
	*/
    @Schema(description="是否启用")
    private Boolean useFlag;

    @Schema(description = "折算值")
	// 折算值改为从站点类型读取
	@TableField(exist = false)
	private Boolean zsFlag;

	/**
	* 超标是否报警 1.是 0. 否
	*/
    @Schema(description="超标是否报警 1.是 0. 否")
    private Boolean alarmFlag;

	/**
	* 最小报警值
	*/
    @Schema(description="最小报警值")
    private BigDecimal minAlarm;

	/**
	* 最大报警值
	*/
    @Schema(description="最大报警值")
    private BigDecimal maxAlarm;

	/**
	* 最大预警值
	*/
    @Schema(description="最大预警值")
    private BigDecimal maxWarnAlarm;

	/**
	* 最大预警值
	*/
    @Schema(description="最大预警值")
    private BigDecimal minWarnAlarm;

	/**
	* 是否有量程
	*/
    @Schema(description="是否有量程")
    private Boolean isHaveRange;

	/**
	* 量程最大值
	*/
    @Schema(description="量程最大值")
    private BigDecimal maxRange;

	/**
	* 量程最小值
	*/
    @Schema(description="量程最小值")
    private BigDecimal minRange;

	/**
	* 计量单位
	*/
    @Schema(description="计量单位")
    private String unit;

	/**
	* 统计单位
	*/
    @Schema(description="统计单位")
    private String statisticUnit;

	/**
	 * 排序号
	 */
	@Schema(description="排序号")
	private Integer sortNum;

	/**
	* 备注
	*/
    @Schema(description="备注")
    private String remarks;

	/**
	* 所属企业
	*/
    @Schema(description="orgId")
    private Long orgId;

    public String getUseFlagStr() {
    	return DictResolver.getItemLabelByValue(SysDictEnum.yes_no_type, this.getUseFlag());
	}

    public String getAlarmFlagStr() {
    	return DictResolver.getItemLabelByValue(SysDictEnum.yes_no_type, this.getAlarmFlag());
	}

	public String getIsHaveRangeStr() {
    	return DictResolver.getItemLabelByValue(SysDictEnum.yes_no_type, this.getIsHaveRange());
	}

    public String getFactorIdStr() {
    	return DictResolver.getItemLabelByValue(PollModDictEnum.factor_info, this.getFactorId());
	}

}
